from base.base_api import Base
from ele_loctor.user_loctor import *
import allure
from time import sleep
@allure.feature("CRMEB-用户分组")
class UserPage(Base):
    @allure.step("输入账号：{text}")
    def input_user(self,text):
        self.input_texts(*user_pwd_ele,0,text)
    @allure.step("输入密码：{text}")
    def input_password(self,text):
        self.input_texts(*user_pwd_ele,1,text)
    @allure.step("点击登录按钮")
    def click_btn(self):
        self.click_ele(*logbtn_ele)
    @allure.step("点击用户icon")
    def click_icon(self):
        self.click_eles(*click_userIcon,1)
    @allure.step("点击用户分组")
    def click_userGroup(self):
        self.click_ele(*click_userGroupIcon)
        sleep(3)
    @allure.step("点击添加用户分组按钮")
    def click_AddUserGroup(self):
        self.click_ele(*click_addUserGroup)
        sleep(2)
    @allure.step("输入分组名称：{text}")
    def input_userName(self,text):
        self.input_texts(*input_userGroupName,2,text)
    @allure.step("点击确认按钮")
    def click_accept(self):
        self.click_eles(*click_acceptBtn,-1)
        sleep(2)
    @allure.step("获取页面内容：{text}")
    def get_UserGroup(self,text):
        texts = self.get_content("xpath",f"//*[text()='{text}']")
        assert text == texts
    @allure.step("点击删除按钮")
    def click_delete_btn(self):
        self.click_eles(*click_del_text,-1)
        sleep(2)








